import Vue from 'vue'
import Router from 'vue-router'
import Record from '@/components/record'
import Pselection from '@/components/portfolio-selection'
import Fillinfo from '@/components/fill-info'
import Contract from '@/components/contract'
import Step from '@/components/step'
import UserInfo from '@/components/user-info'
import process from '@/components/process'
import Vresults from '@/components/vresults'

Vue.use(Router)

export default new Router({
    routes: [{
        path: '/',
        name: 'Pselection',
        component: Pselection
    }, {
        path: '/record',
        name: 'Record',
        component: Record
    },{
        path: '/userInfo',
        name: 'UserInfo',
        component: UserInfo
    }, {
        path: '/info',
        name: 'Fillinfo',
        component: Fillinfo
    }, {
        path: '/contract',
        name: 'Contract',
        component: Contract
    }, {
        path: '/step',
        name: 'Step',
        component: Step,
        beforeEnter: (to, from, next) => {
            var stepNum = 0;
            var stepTimer = setInterval(function() {
                var $steps = $(".step-box").children();
                console.dir($steps);
                $steps.eq(stepNum).fadeIn();
                stepNum++;
                if (stepNum > 4) {

                    $('#recording').fadeIn();
                    $('#recording').css({
                        "display": "block"
                    });
                    clearInterval(stepTimer);
                }
            }, 1500);
            next()
        }
    }, {
        path: '/process',
        name: 'Process',
        component: process
    },{
        path: '/vresults',
        name: 'Vresults',
        component: Vresults

    }]
})
